package engine.gui;

import engine.gui.elements.Image;

public class GUIStyle {

	//private BitmapFont font;
	private Font font;
	
	//style data for buttons
	private Image buttonBackgroundImage;
	private Image buttonHoverImage;
	private Image buttonActivateImage;
	private float[] buttonStandardColor = new float[]{1, 1, 1, 1};
	private float[] buttonHoverColor = new float[]{1, 1, 1, 1};
	private float[] buttonActivatedColor = new float[]{1, 1, 1, 1};
	private float[] buttonTextColor = new float[]{1, 1, 1, 1};
	private float[] buttonTextHoverColor = new float[]{1, 1, 1, 1};
	private float[] buttonTextActiveColor = new float[]{1, 1, 1, 1};
	
	//style data for panels
	private boolean panelBorder;
	private Image panelImage;
	private float[] panelColor = new float[]{1, 1, 1, 1};
	
	//style data for labels
	private float[] labelColor = new float[]{1, 1, 1, 1};
	
	//style data for text fields
	private boolean textFieldBorder;
	private Image textFieldImage;
	private int textFieldCursorOffset;
	private float[] textFieldTextColor = new float[]{1, 1, 1, 1};
	private float[] textFieldBackgroundColor = new float[]{1, 1, 1, 1};
	private float[] textFieldBorderColor = new float[]{1, 1, 1, 1};
	private float[] textFieldCursorColor = new float[]{1, 1, 1, 1};
	
	//style data for check boxes
	private Image checkBoxBackgroundImage;
	private Image checkBoxEnabledImage;
	private Image checkBoxDisabledImage;
	private float[] checkBoxBackgroundColor = new float[]{1, 1, 1, 1};
	private float[] checkBoxEnabledColor = new float[]{1, 1, 1, 1};
	private float[] checkBoxDisabledColor = new float[]{1, 1, 1, 1};
	private float[] checkBoxTextColor = new float[]{1, 1, 1, 1};
	
	//style data for popup
	private Image popupHeaderImage;
	private Image popupBodyImage;
	private Image popupCloseButtonImage;
	private int popupHeaderHeight;
	private int popupPadding;
	private float[] popupHeaderColor = new float[]{1, 1, 1, 1};
	private float[] popupBodyColor = new float[]{1, 1, 1, 1};
	
	//style data for radio button grop
	private Image radioButtonBackgroundImage;
	private Image radioButtonActiveImage;
	private float[] radioButtonBackgroundColor = new float[]{1, 1, 1, 1};
	private float[] radioButtonActiveColor = new float[]{1, 1, 1, 1};
	private float[] radioButtonTextColor = new float[]{1, 1, 1, 1};
	
	//style data for slider
	private Image sliderBackgroundImage;
	private Image sliderSelectorImage;
	private float[] sliderBackgroundColor = new float[]{1, 1, 1, 1};
	private float[] sliderSelectorColor = new float[]{1, 1, 1, 1};
	
	//style data for scroll panes
	private Image scrollPaneBackgroundImage;
	private Image scrollPaneSliderImage;
	private int scrollPaneScrollBarSize;
	private boolean scrollPaneBorder;
	private float[] scrollPaneBackgroundColor = new float[]{1, 1, 1, 1};
	private float[] scrollPaneSliderColor = new float[]{1, 1, 1, 1};
	
	public GUIStyle(Font font) {
		this.font = font;
	}
	
	public Image getButtonBackgroundImage() {
		return buttonBackgroundImage;
	}
	
	public void setButtonBackgroundImage(Image buttonImage) {
		this.buttonBackgroundImage = buttonImage;
	}
	
	public Image getButtonHoverImage() {
		return buttonHoverImage;
	}
	
	public void setButtonHoverImage(Image buttonHoverImage) {
		this.buttonHoverImage = buttonHoverImage;
	}
	
	public Image getButtonActivateImage() {
		return buttonActivateImage;
	}
	
	public void setButtonActivateImage(Image buttonActivateImage) {
		this.buttonActivateImage = buttonActivateImage;
	}
	
	public float[] getButtonStandardColor() {
		return buttonStandardColor;
	}
	
	public void setButtonStandardColor(float r, float g, float b, float a) {
		this.buttonStandardColor[0] = r;
		this.buttonStandardColor[1] = g;
		this.buttonStandardColor[2] = b;
		this.buttonStandardColor[3] = a;
	}
	
	public float[] getButtonHoverColor() {
		return buttonHoverColor;
	}
	
	public void setButtonHoverColor(float r, float g, float b, float a) {
		this.buttonHoverColor[0] = r;
		this.buttonHoverColor[1] = g;
		this.buttonHoverColor[2] = b;
		this.buttonHoverColor[3] = a;
	}
	
	public float[] getButtonActivatedColor() {
		return buttonActivatedColor;
	}
	
	public void setButtonActivatedColor(float r, float g, float b, float a) {
		this.buttonActivatedColor[0] = r;
		this.buttonActivatedColor[1] = g;
		this.buttonActivatedColor[2] = b;
		this.buttonActivatedColor[3] = a;
	}
	
	public float[] getButtonTextColor() {
		return buttonTextColor;
	}

	public void setButtonTextColor(float r, float g, float b, float a) {
		this.buttonTextColor[0] = r;
		this.buttonTextColor[1] = g;
		this.buttonTextColor[2] = b;
		this.buttonTextColor[3] = a;
	}

	public float[] getButtonTextHoverColor() {
		return buttonTextHoverColor;
	}

	public void setButtonTextHoverColor(float r, float g, float b, float a) {
		this.buttonTextHoverColor[0] = r;
		this.buttonTextHoverColor[1] = g;
		this.buttonTextHoverColor[2] = b;
		this.buttonTextHoverColor[3] = a;
	}

	public float[] getButtonTextActiveColor() {
		return buttonTextActiveColor;
	}

	public void setButtonTextActiveColor(float r, float g, float b, float a) {
		this.buttonTextActiveColor[0] = r;
		this.buttonTextActiveColor[1] = g;
		this.buttonTextActiveColor[2] = b;
		this.buttonTextActiveColor[3] = a;
	}
	
	public boolean isPanelBorder() {
		return panelBorder;
	}
	
	public void setPanelBorder(boolean panelBorder) {
		this.panelBorder = panelBorder;
	}
	
	public Image getPanelImage() {
		return panelImage;
	}
	
	public void setPanelImage(Image panelImage) {
		this.panelImage = panelImage;
	}
	
	public float[] getPanelColor() {
		return panelColor;
	}
	
	public void setPanelColor(float r, float g, float b, float a) {
		this.panelColor[0] = r;
		this.panelColor[1] = g;
		this.panelColor[2] = b;
		this.panelColor[3] = a;
	}
	
	public Font getFont() {
		return font;
	}
	
	public void setFont(Font font) {
		this.font = font;
	}
	
	public float[] getLabelColor() {
		return labelColor;
	}
	
	public void setLabelColor(float r, float g, float b, float a) {
		this.labelColor[0] = r;
		this.labelColor[1] = g;
		this.labelColor[2] = b;
		this.labelColor[3] = a;
	}
	
	public boolean isTextFieldBorder() {
		return textFieldBorder;
	}

	public void setTextFieldBorder(boolean textFieldBorder) {
		this.textFieldBorder = textFieldBorder;
	}

	public Image getTextFieldImage() {
		return textFieldImage;
	}

	public void setTextFieldImage(Image textFieldImage) {
		this.textFieldImage = textFieldImage;
	}
	
	public int getTextFieldCursorOffset() {
		return textFieldCursorOffset;
	}
	
	public void setTextFieldCursorOffset(int textFieldCursorOffset) {
		this.textFieldCursorOffset = textFieldCursorOffset;
	}
	
	public float[] getTextFieldTextColor() {
		return textFieldTextColor;
	}
	
	public void setTextFieldTextColor(float r, float g, float b, float a) {
		this.textFieldTextColor[0] = r;
		this.textFieldTextColor[1] = g;
		this.textFieldTextColor[2] = b;
		this.textFieldTextColor[3] = a;
	}
	
	public float[] getTextFieldBackgroundColor() {
		return textFieldBackgroundColor;
	}
	
	public void setTextFieldBackgroundColor(float r, float g, float b, float a) {
		this.textFieldBackgroundColor[0] = r;
		this.textFieldBackgroundColor[1] = g;
		this.textFieldBackgroundColor[2] = b;
		this.textFieldBackgroundColor[3] = a;
	}
	
	public float[] getTextFieldBorderColor() {
		return textFieldBorderColor;
	}
	
	public void setTextFieldBorderColor(float r, float g, float b, float a) {
		this.textFieldBorderColor[0] = r;
		this.textFieldBorderColor[1] = g;
		this.textFieldBorderColor[2] = b;
		this.textFieldBorderColor[3] = a;
	}
	
	public float[] getTextFieldCursorColor() {
		return textFieldCursorColor;
	}

	public void setTextFieldCursorColor(float r, float g, float b, float a) {
		this.textFieldCursorColor[0] = r;
		this.textFieldCursorColor[1] = g;
		this.textFieldCursorColor[2] = b;
		this.textFieldCursorColor[3] = a;
	}
	
	public Image getCheckBoxBackgroundImage() {
		return checkBoxBackgroundImage;
	}

	public void setCheckBoxBackgroundImage(Image checkBoxBackgroundImage) {
		this.checkBoxBackgroundImage = checkBoxBackgroundImage;
	}

	public Image getCheckBoxEnabledImage() {
		return checkBoxEnabledImage;
	}

	public void setCheckBoxEnabledImage(Image checkBoxEnabledImage) {
		this.checkBoxEnabledImage = checkBoxEnabledImage;
	}

	public Image getCheckBoxDisabledImage() {
		return checkBoxDisabledImage;
	}

	public void setCheckBoxDisabledImage(Image checkBoxDisabledImage) {
		this.checkBoxDisabledImage = checkBoxDisabledImage;
	}

	public float[] getCheckBoxBackgroundColor() {
		return checkBoxBackgroundColor;
	}

	public void setCheckBoxBackgroundColor(float r, float g, float b, float a) {
		this.checkBoxBackgroundColor[0] = r;
		this.checkBoxBackgroundColor[1] = g;
		this.checkBoxBackgroundColor[2] = b;
		this.checkBoxBackgroundColor[3] = a;
	}

	public float[] getCheckBoxEnabledColor() {
		return checkBoxEnabledColor;
	}

	public void setCheckBoxEnabledColor(float r, float g, float b, float a) {
		this.checkBoxEnabledColor[0] = r;
		this.checkBoxEnabledColor[1] = g;
		this.checkBoxEnabledColor[2] = b;
		this.checkBoxEnabledColor[3] = a;
	}

	public float[] getCheckBoxDisabledColor() {
		return checkBoxDisabledColor;
	}

	public void setCheckBoxDisabledColor(float r, float g, float b, float a) {
		this.checkBoxDisabledColor[0] = r;
		this.checkBoxDisabledColor[1] = g;
		this.checkBoxDisabledColor[2] = b;
		this.checkBoxDisabledColor[3] = a;
	}
	
	public float[] getCheckBoxTextColor() {
		return checkBoxTextColor;
	}
	
	public void setCheckBoxTextColor(float r, float g, float b, float a) {
		this.checkBoxTextColor[0] = r;
		this.checkBoxTextColor[1] = g;
		this.checkBoxTextColor[2] = b;
		this.checkBoxTextColor[3] = a;
	}
	
	public Image getPopupHeaderImage() {
		return popupHeaderImage;
	}

	public void setPopupHeaderImage(Image popupHeaderImage) {
		this.popupHeaderImage = popupHeaderImage;
	}

	public Image getPopupBodyImage() {
		return popupBodyImage;
	}

	public void setPopupBodyImage(Image popupBodyImage) {
		this.popupBodyImage = popupBodyImage;
	}

	public Image getPopupCloseButtonImage() {
		return popupCloseButtonImage;
	}

	public void setPopupCloseButtonImage(Image popupCloseButtonImage) {
		this.popupCloseButtonImage = popupCloseButtonImage;
	}
	
	public int getPopupHeaderHeight() {
		return popupHeaderHeight;
	}
	
	public void setPopupHeaderHeight(int popupHeaderHeight) {
		this.popupHeaderHeight = popupHeaderHeight;
	}
	
	public int getPopupPadding() {
		return popupPadding;
	}
	
	public void setPopupPadding(int popupPadding) {
		this.popupPadding = popupPadding;
	}

	public float[] getPopupHeaderColor() {
		return popupHeaderColor;
	}

	public void setPopupHeaderColor(float r, float g, float b, float a) {
		this.popupHeaderColor[0] = r;
		this.popupHeaderColor[1] = g;
		this.popupHeaderColor[2] = b;
		this.popupHeaderColor[3] = a;
	}

	public float[] getPopupBodyColor() {
		return popupBodyColor;
	}

	public void setPopupBodyColor(float r, float g, float b, float a) {
		this.popupBodyColor[0] = r;
		this.popupBodyColor[1] = g;
		this.popupBodyColor[2] = b;
		this.popupBodyColor[3] = a;
	}
	
	public Image getRadioButtonBackgroundImage() {
		return radioButtonBackgroundImage;
	}

	public void setRadioButtonBackgroundImage(Image radioButtonBackgroundImage) {
		this.radioButtonBackgroundImage = radioButtonBackgroundImage;
	}

	public Image getRadioButtonActiveImage() {
		return radioButtonActiveImage;
	}

	public void setRadioButtonActiveImage(Image radioButtonActiveImage) {
		this.radioButtonActiveImage = radioButtonActiveImage;
	}

	public float[] getRadioButtonBackgroundColor() {
		return radioButtonBackgroundColor;
	}

	public void setRadioButtonBackgroundColor(
			float r, float g, float b, float a) {
		this.radioButtonBackgroundColor[0] = r;
		this.radioButtonBackgroundColor[1] = g;
		this.radioButtonBackgroundColor[2] = b;
		this.radioButtonBackgroundColor[3] = a;
	}

	public float[] getRadioButtonActiveColor() {
		return radioButtonActiveColor;
	}

	public void setRadioButtonActiveColor(float r, float g, float b, float a) {
		this.radioButtonActiveColor[0] = r;
		this.radioButtonActiveColor[1] = g;
		this.radioButtonActiveColor[2] = b;
		this.radioButtonActiveColor[3] = a;
	}

	public float[] getRadioButtonTextColor() {
		return radioButtonTextColor;
	}

	public void setRadioButtonTextColor(float r, float g, float b, float a) {
		this.radioButtonTextColor[0] = r;
		this.radioButtonTextColor[1] = r;
		this.radioButtonTextColor[2] = r;
		this.radioButtonTextColor[3] = r;
	}
	
	public Image getSliderBackgroundImage() {
		return sliderBackgroundImage;
	}

	public void setSliderBackgroundImage(Image sliderBackgroundImage) {
		this.sliderBackgroundImage = sliderBackgroundImage;
	}

	public Image getSliderSelectorImage() {
		return sliderSelectorImage;
	}

	public void setSliderSelectorImage(Image sliderSelectorImage) {
		this.sliderSelectorImage = sliderSelectorImage;
	}

	public float[] getSliderBackgroundColor() {
		return sliderBackgroundColor;
	}

	public void setSliderBackgroundColor(float r, float g, float b, float a) {
		this.sliderBackgroundColor[0] = r;
		this.sliderBackgroundColor[1] = g;
		this.sliderBackgroundColor[2] = b;
		this.sliderBackgroundColor[3] = a;
	}

	public float[] getSliderSelectorColor() {
		return sliderSelectorColor;
	}

	public void setSliderSelectorColor(float r, float g, float b, float a) {
		this.sliderSelectorColor[0] = r;
		this.sliderSelectorColor[1] = g;
		this.sliderSelectorColor[2] = b;
		this.sliderSelectorColor[3] = a;
	}
	
	public static final GUIStyle getDefaultStyle() {
		BitmapFont font = new BitmapFont("Arial", 18, false);
		GUIStyle guiStyle = new GUIStyle(font);
		
		//button background image
		Image buttonBackgroundImage = new Image("img/gui/default/button_default.png", 32, 32);
		buttonBackgroundImage.setBorder(4);
		guiStyle.setButtonBackgroundImage(buttonBackgroundImage);
		guiStyle.setButtonTextColor(0, 0, 0, 1);
		
		//button hover
		Image buttonHoverImage = new Image("img/gui/default/button_hover.png", 32, 32);
		buttonHoverImage.setBorder(4);
		guiStyle.setButtonHoverImage(buttonHoverImage);
		guiStyle.setButtonTextHoverColor(1, 1, 1, 1);
		
		//button hover
		Image buttonActiveImage = new Image("img/gui/default/button_active.png", 32, 32);
		buttonActiveImage.setBorder(4);
		guiStyle.setButtonActivateImage(buttonActiveImage);
		
		//panel border
		guiStyle.setPanelBorder(false);
		
		//panel image
		Image panelImage = new Image("img/gui/default/panel.png", 32, 32);
		panelImage.setBorder(5);
		guiStyle.setPanelImage(panelImage);
		
		//panel color
		guiStyle.setPanelColor(1, 1, 1, 0.5f);
		
		//text field image
		Image textfieldImage = new Image("img/gui/default/textfield.png", 32, 32);
		textfieldImage.setBorder(4);
		guiStyle.setTextFieldImage(textfieldImage);
		
		//set text field cursor offset according to image border
		guiStyle.setTextFieldCursorOffset(3);
		
		//text field border color
		guiStyle.setTextFieldBorder(false);
		
		//text field color
		guiStyle.setTextFieldTextColor(0, 0, 0, 1);
		
		//text field cursor color
		guiStyle.setTextFieldCursorColor(0, 0, 0, 1);
		
		//check box background image
		Image checkBoxBackgroundImage = new Image("img/gui/default/checkbox_background.png", 32, 32);
		checkBoxBackgroundImage.setBorder(4);
		guiStyle.setCheckBoxBackgroundImage(checkBoxBackgroundImage);
		
		//check box enable image
		Image checkBoxEnabledImage = new Image("img/gui/default/checkbox_enabled.png", 32, 32);
		checkBoxEnabledImage.setBorder(4);
		guiStyle.setCheckBoxEnabledImage(checkBoxEnabledImage);
		
		//popup header height
		guiStyle.setPopupHeaderHeight(30);
		
		//popup body padding
		guiStyle.setPopupPadding(5);
		
		//popup header image
		Image popupHeaderImage = new Image("img/gui/default/popup_header.png", 32, 32);
		popupHeaderImage.setBorder(5);
		guiStyle.setPopupHeaderImage(popupHeaderImage);
		
		//popup header color
		guiStyle.setPopupHeaderColor(1, 1, 1, 0.7f);
		
		//popup body image
		Image popupBodyImage = new Image("img/gui/default/popup_body.png", 32, 32);
		popupBodyImage.setBorder(5);
		guiStyle.setPopupBodyImage(popupBodyImage);
		
		//popup body color
		guiStyle.setPopupBodyColor(1, 1, 1, 0.7f);
		
		//popup close button
		Image popupCloseButtonImage = new Image("img/gui/default/popup_close_button.png", 32, 32);
		popupCloseButtonImage.setBorder(5);
		guiStyle.setPopupCloseButtonImage(popupCloseButtonImage);
		
		//radio button background image
		Image radioButtonBackgroundImage = new Image("img/gui/default/radiobutton_background.png", 32, 32);
		guiStyle.setRadioButtonBackgroundImage(radioButtonBackgroundImage);
		
		//radio button active image
		Image radioButtonActiveImage = new Image("img/gui/default/radiobutton_active.png", 32, 32);
		guiStyle.setRadioButtonActiveImage(radioButtonActiveImage);
		
		//slider background image
		Image sliderBackgroundImage = new Image("img/gui/default/slider_background.png", 32, 32);
		sliderBackgroundImage.setBorder(3);
		guiStyle.setSliderBackgroundImage(sliderBackgroundImage);
		
		//slider selector image
		Image sliderSelectorImage = new Image("img/gui/default/slider_selector.png", 32, 32);
		guiStyle.setSliderSelectorImage(sliderSelectorImage);
		
		//scroll pane border
		guiStyle.setScrollPaneBorder(true);
		
		return guiStyle;
	}

	public Image getScrollPaneBackgroundImage() {
		return scrollPaneBackgroundImage;
	}

	public void setScrollPaneBackgroundImage(Image scrollPaneBackgroundImage) {
		this.scrollPaneBackgroundImage = scrollPaneBackgroundImage;
	}

	public Image getScrollPaneSliderImage() {
		return scrollPaneSliderImage;
	}

	public void setScrollPaneSliderImage(Image scrollPaneSliderImage) {
		this.scrollPaneSliderImage = scrollPaneSliderImage;
	}
	
	public int getScrollPaneScrollBarSize() {
		return scrollPaneScrollBarSize;
	}
	
	public void setScrollPaneScrollBarSize(int scrollPaneScrollBarSize) {
		this.scrollPaneScrollBarSize = scrollPaneScrollBarSize;
	}

	public float[] getScrollPaneBackgroundColor() {
		return scrollPaneBackgroundColor;
	}

	public void setScrollPaneBackgroundColor(float r, float g, float b, float a) {
		this.scrollPaneBackgroundColor[0] = r;
		this.scrollPaneBackgroundColor[1] = g;
		this.scrollPaneBackgroundColor[2] = b;
		this.scrollPaneBackgroundColor[3] = a;
	}

	public float[] getScrollPaneSliderColor() {
		return scrollPaneSliderColor;
	}

	public void setScrollPaneSliderColor(float r, float g, float b, float a) {
		this.scrollPaneSliderColor[0] = r;
		this.scrollPaneSliderColor[1] = g;
		this.scrollPaneSliderColor[2] = b;
		this.scrollPaneSliderColor[3] = a;
	}

	public boolean isScrollPaneBorder() {
		return scrollPaneBorder;
	}

	public void setScrollPaneBorder(boolean scrollPaneBorder) {
		this.scrollPaneBorder = scrollPaneBorder;
	}
}
